<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>copyf2array</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="copya2ftab.html" title="copya2ftab" />
    <link rel="next" href="cos.html" title="cos" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">copyf2array</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="copya2ftab.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="cos.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="copyf2array"></a>
      <div class="titlepage"></div>
      <a id="IndexCopyf2array" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">copyf2array</span>
        </h2>
        <p>copyf2array — 
      Copy data from an f-table to a vector.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp95605392"></a>
        <h2>Description</h2>
        <p>
      The <span class="emphasis"><em>copyf2array</em></span> opcode takes an f-table and
      copies the contents to a t-var.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp95607024"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>copyf2array</strong></span> tab, kftbl</pre>
      </div>
      <div class="refsect1">
        <a id="idp95672400"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>tab</em></span> --  tables for destination.
    </p>
        <p>
      <span class="emphasis"><em>kftbl</em></span> --  f-tables for source.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp95674704"></a>
        <h2>Example</h2>
        <p>
      Here is an example of the copyf2array opcode. It uses the file
      <a class="ulink" href="examples/copyf2array.csd" target="_top"><em class="citetitle">copyf2array.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp95676352"></a>
          <p class="title">
            <strong>Example 136. Example of the copyf2array opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-n
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1

<span class="comment">;8 points sine wave function table</span>
giSine  <span class="ohdr">ftgen</span>   0, 0, 8, 10, 1


  <span class="oblock">instr</span> 1
<span class="comment">;create array</span>
kArr[]  <span class="opc">init</span>    8

<span class="comment">;copy table values in it</span>
        <span class="opc">copyf2array</span> kArr, giSine
        
<span class="comment">;print values</span>
kndx    <span class="op">=</span>       0
  until kndx <span class="op">==</span> <span class="opc">lenarray</span>(kArr) do
        <span class="opc">printf</span>  "kArr[<span class="op">%</span>d] <span class="op">=</span> <span class="op">%</span>f\n", kndx<span class="op">+</span>1, kndx, kArr[kndx]
kndx    <span class="op">+</span><span class="op">=</span>      1
  od

<span class="comment">;turn instrument off</span>
        <span class="opc">turnoff</span>
  <span class="oblock">endin</span>
  
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">i</span> 1 0 0.1
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp95679760"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="copya2ftab.html" title="copya2ftab"><em class="citetitle">copya2ftab</em></a>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp95681664"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: John ffitch</td>
          </tr>
          <tr>
            <td>October 2011</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in Csound version 5.15</p>
        <p>Renamed in Csound version 6.00</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="copya2ftab.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="cos.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">copya2ftab </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> cos</td>
        </tr>
      </table>
    </div>
  </body>
</html>
